/**
 * 
 */
package it.paceGiuseppe.sols.ciambelle;

/**
 * @author giuseppe
 *
 */
public final class GestoreIngredienti extends Thread {

	private MonitorCiambelle monitor;
	private Impastatrice impastatrice;
	
	
	
	public GestoreIngredienti(MonitorCiambelle monitor,
			Impastatrice impastatrice) {
		super();
		this.monitor = monitor;
		this.impastatrice = impastatrice;
	}



	@Override
	public void run() {
		while(true)
		{
			try {
				monitor.richiestaAggiuntaIngrediente();
				
				impastatrice.incrementaIngredienti();
				sleep(500);
				monitor.fineAggiuntaIngrediente();
			} catch (IllegalStateException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
